/**
 * @param {number} left
 * @param {number} right
 * @return {number[]}
 */
var selfDividingNumbers = function(left, right) {
  left == 0 ? (left = 1) : ""
  var arr = []
  for (var i = left; i <= right; i++) {
    if (i >= 10) {
      var s = i.toString()
      var tag = true
      for (var j = 0; j < s.length; j++) {
        if (i % s[j] != 0) {
          tag = false
          break
        }
      }
      if (tag) arr.push(i)
    } else {
      arr.push(i)
    }
  }
  return arr
}

console.log(selfDividingNumbers(1, 22))
